package com.hanhai.material.scheduling.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hanhai.material.device.entity.SysMachinePlc;
import com.hanhai.material.device.entity.SysWorkPlan;
import com.mybatisflex.annotation.*;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
 *  实体类。
 *
 * @author youchuang
 * @since 2024/04/19 16:20:27
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "sys_product_people",dataSource = "scheduling")
public class SysProductPeople implements Serializable {

    @Id
    private String id;

    private String productMachineId;

    /**
     * 工作日期
     */
    private Date workDate;

    /**
     * 工作时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date workTime;

    /**
     * 工作时间序列
     */
    private String workTimeIndex;

    /**
     * 机台
     */
    private String machineCode;

    private String machineArea;

    private String machineName;

    /**
     * 用户名
     */
    private String userName;

    /**
     * 用户ID
     */
    private String userId;

    private String jobNo;

    /**
     * 直接领导
     */
    private String directlyManager;

    private String workPlanId;

    private String createUserId;

    private String updateUserId;

    @Column(onInsertValue = "now()")
    private Date createTime;
    @Column(onUpdateValue = "now()")
    private Date updateTime;

    private Integer isChange;

    private String toMachineCode;

    private String toMachineName;

    private String summary;

    private String workShopName;

    private String shift;

    private String shiftCode;

    private String machinePosition;
    @RelationOneToOne(selfField = "machineName",targetField = "machineName",dataSource = "scheduling")
    private SysMachinePlc machinePlc;

    @RelationOneToOne(selfField = "workPlanId",targetField = "workPlanId")
    private SysWorkPlan workPlan;

//    @RelationOneToMany(selfField = "workPlanId",targetField = "workPlanId",extraCondition = "shift = :shift and work_date = :workDate")
    @Column(ignore = true)
    private List<SysProductPeople> productPeopleList;
    @Column(ignore = true)
    private List<SysProductPeople> list;




}
